<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {:widget_st('layui','css')}
  {:widget_st('admin','css')}
  {:widget_st('bootstrap')}
  {:widget_st('jq','js')}
</head>
{:do_action('admin_head')}
<body>

  <div class="layui-fluid">
    <div class="layui-card">
      <div class="layui-card-body">
        <table class="layui-table">
            <colgroup>
              <col width="30">
              <col width="60">
              <col width="60">
              <col width="60">
              <col width="60">
              <col width="60">
              <col>
            </colgroup>
            <thead>
              <tr>
                <th>ID</th>
                <th>名称</th>
                <th>状态/失败次数</th>
                <th>时间</th>
                <th>IP</th>
                <th>参数</th>
              </tr> 
            </thead>
            <tbody>
              <?php foreach($list as $k=>$vo){ ?>
                <tr>
                  <td>{$vo['id']}</td>
                  <td>{$vo['name']}</td>
                  <td>
                    {$vo['err_num']=='0'?'登录成功':$vo['err_num']}
                  </td>
                  <td><?php echo date("Y-m-d H:i:s",$vo['ctime']); ?></td>
                  <td>{$vo['ip']}</td>
                  <td  class="zf-layui-tips" data-d="{$vo['post']}"  > 
                    {$vo['post']|mb_substr=0,20,'utf-8'}
                  </td>
                </tr>
              <?php } ?>
            </tbody>
          </table>
          {$page|raw}
      </div>
    </div>
  </div>
  
  {:widget_st('layui','js')}  
  {:widget_st('common','js')} 

  <script>
 layui.use([ 'table'], function(){
    var $ = layui.$
    ,form = layui.form
    ,table = layui.table;
    $('.zf-layui-tips').on('click', function(){
    var othis = $(this).attr('data-d')
    var html = ''
    html+='参数:'+othis+'<br>'
    layer.open({
      type: 1, // page 层类型
      area: ['500px', '300px'],
      title: '相关参数',
      shade: 0.6, // 遮罩透明度
      shadeClose: true, // 点击遮罩区域，关闭弹层
      maxmin: true, // 允许全屏最小化
      anim: 0, // 0-6 的动画形式，-1 不开启
      content: '<div style="padding: 10px;word-break: break-all;">'+html+'</div>'
    });
  });

    form.on('switch(status_change)', function(data){
      var id = $(this).attr("item")
      var dbname = 'admin_log'
      var status = this.checked ? '1' : '0'
      console.log(id)
      $.get("{:url('admin/common/is_switch')}",{id:id,dbname:dbname,status:status},function(res){
          if(res.result==1){
            layer.msg(res.msg, {icon: 1});
          }else{
            layer.msg(res.msg, {icon: 2});
          }
        },"json");
    });
   
   
  });
  </script>
</body>
</html>
{:do_action('admin_js')}
